<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;

class User extends Controller
{
  public function lst()
  {
    $user = Db::name('user')->order('id desc')->paginate(20);
    $this->assign('user',$user);
    return view();
  }

  public function add()
  {
    $post = input('post.');
    if(Db::name('user')->insert($post)){
      $this->success('提交成功我们会尽快联系您');
    } else {
      $this->error('提交失败');
    }
  }

  public function delete()
  {
    $id = input('id');
    if(Db::name('user')->where('id',$id)->delete()){
      $this->success('删除成功','user/lst');
    } else {
      $this->error('删除成功','user/lst');
    }
  }
}
?>